package com.yunhe.option.service.data;

import com.yunhe.option.domain.data.SeasonPriceDetail;
import com.yunhe.common.exception.ArgumentErrorException;
import com.yunhe.common.exception.ObjectNotFoundException;
import com.yunhe.common.exception.UniqueConstraintsException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Optional;

@Service
public interface SeasonPriceDetailService {
    @Transactional
    SeasonPriceDetail create(SeasonPriceDetail seasonPriceDetail, Long seasonPriceCode)
            throws ArgumentErrorException, UniqueConstraintsException, ObjectNotFoundException;

    @Transactional
    Iterable<SeasonPriceDetail> create(List<SeasonPriceDetail> details, Long seasonPriceCode)
            throws ArgumentErrorException, UniqueConstraintsException, ObjectNotFoundException;

    @Transactional
    void delete(Long seasonPriceDetailId) throws ObjectNotFoundException, UniqueConstraintsException, ArgumentErrorException;

    @Transactional
    SeasonPriceDetail update(SeasonPriceDetail seasonPriceDetail)
        throws ArgumentErrorException, UniqueConstraintsException, ObjectNotFoundException;

    @Transactional
    SeasonPriceDetail update(Long seasonPriceId,
                             Long seasonPriceDetailId,
                             Double price,
                             Date startTime,
                             Date endTime)
        throws ArgumentErrorException, ObjectNotFoundException, UniqueConstraintsException;

    @Transactional
    Iterable<SeasonPriceDetail> search(Long seasonPriceId,
                                       Long priceRateCode);

    @Transactional
    Optional<SeasonPriceDetail> findById(Long Id);

    @Transactional
    void deleteBySeasonPriceIdAndPriceRateCode(Long seasonPriceId, Long priceRateCode) throws ArgumentErrorException;
}
